import http from '@/http';
import type {ProvinceInfo, ResponseData, WeatherResponse} from "@/types/interface";

const weatherApi = {
  getWeather: (cityCode: number): Promise<WeatherResponse> => {
    // 使用新增的rawGet方法，直接请求完整URL
    return http.rawGet<WeatherResponse>(
        `https://restapi.amap.com/v3/weather/weatherInfo`,
        {
          city: cityCode,
          key: '7ad4bddca5b6def617eaf473d5f6c0ed',
          extensions: 'base'
        }
    );
  },
  getAllProvinceWeather: (): Promise<ResponseData<ProvinceInfo[]>> => {
        return http.get('/weather/province/list');
  }
};

export default weatherApi;